
<extend name="Application/Admin/View/head.html" />
		<block name="conten">

					<div class="row">
						<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
							<div class="panel panel-default bk-bg-white">
								<div class="panel-heading bk-bg-white">
									<h6><i class="fa fa-indent red"></i>商品分类添加</h6>							
									<div class="panel-actions">
										<a href="#" class="btn-minimize"><i class="fa fa-caret-up"></i></a>
										<a href="#" class="btn-close"><i class="fa fa-times"></i></a>
									</div>
								</div>
								<div class="panel-body">
									<form action="" method="post" enctype="multipart/form-data" class="form-horizontal ">

									<div class="form-group">
											<label class="col-md-3 control-label" for="text-input" name="pid">父级：</label>

											<div class="col-md-9">
												<select type="text" id="text-input" name="pid" class="form-control">

												<option value="0">顶级</option>

												<foreach name="data" item="v">
												
												<option  value="{$v['id']}">{$v['c_name']}</option>
												</foreach>
												</select>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 control-label" for="text-input" name="c_name">商品分类名：</label>
											<div class="col-md-9">
												<input type="text" id="text-input" name="c_name" class="form-control" >
											</div>
										</div>
									
																	
										<div class="form-group">
											<label class="col-md-3 control-label">是否显示：</label>
											
											<div class="checkbox-inline">
												<input type="radio" id="inline-radio1" name="sex" value="1"> 
												<label for="inline-radio1">是</label>
											</div>
											<div class=" checkbox-inline">
												<input type="radio" id="inline-radio2" name="sex" value="0"> 
												<label for="inline-radio2">否</label>
											</div>
																				
											</div>
											<div class="col-sm-4 text-right">
													<button type="submit" class="btn btn-primary hidden-xs">添加</button>
													
												</div>
										</div>


							
											
										<br>

								<div class="panel-body bk-fg-info">
					
								  </div>
							  </div>
									</form>
								</div>								
							</div>

							 
						</div>
						<script src="__ADMIN__/assets/vendor/js/jquery.min.js"></script>
		<script src="__ADMIN__/assets/vendor/js/jquery-2.1.1.min.js"></script>
		<script src="__ADMIN__/assets/vendor/js/jquery-migrate-1.2.1.min.js"></script>
		<script src="__ADMIN__/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
		<script src="__ADMIN__/assets/vendor/skycons/js/skycons.js"></script>	
		<script src="__ADMIN__/assets/vendor/js/pace.min.js"></script>
		<script src="__ADMIN__/assets/vendor/js/jquery-migrate-1.2.1.min.js"></script>
		<!-- Plugins JS-->
		<script src="__ADMIN__/assets/plugins/jquery-ui/js/jquery-ui-1.10.4.min.js"></script>
		<script src="__ADMIN__/assets/plugins/touchpunch/js/jquery.ui.touch-punch.min.js"></script>		
		<script src="__ADMIN__/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script src="__ADMIN__/assets/plugins/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
		<script src="__ADMIN__/assets/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
		<script src="__ADMIN__/assets/plugins/bootstrap-tagsinput/js/bootstrap-tagsinput.js"></script>
		<script src="__ADMIN__/assets/plugins/maskedinput/js/jquery.maskedinput.js"></script>
		<script src="__ADMIN__/assets/plugins/sparkline/js/jquery.sparkline.min.js"></script>
		
		<!-- Theme JS -->		
		<script src="__ADMIN__/assets/js/jquery.mmenu.min.js"></script>
		<script src="__ADMIN__/assets/js/core.min.js"></script>
		
		<!-- Pages JS -->
		<script src="__ADMIN__/assets/js/pages/form-elements.js"></script>

		<script type="text/javascript">
		$(function(){
			$('select').live('change',function(){
				var id = $(this).val();
				var child = $(this);
				$(this).nextAll().remove();
				if (id==0) {
					return false;
				}

				$.ajax({
				   type: "POST",
				   url: "{:U('Ajax/category')}",
				   data: {'id':id},
				   dataType:"json",
				   success: function(e){

						var html = '';
				     	html+='<select class="form-control" name="pid" type="text">';
				     	html+='<option value="'+id+'">顶级</option>';
				     	if (e!='') {
				      	for (i in e){
				      	 	html+='<option value="'+e[i].id+'">'+e[i].c_name+'</option>';
				      	}
				      	html+='</select>';
				      	child.parent().append(html);				   	
				      }
				   	}
				});
				
			});
		})
		</script>
		</block>


		